<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/2/24
 * Time: 9:23
 * Project name: PHPTEST
 * File name: language.oop5.inheritance.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */


class Father{

    public function pub(){
        echo __METHOD__.PHP_EOL;
    }

    public function pro(){
        echo __METHOD__.PHP_EOL;
    }

    private function pri(){
        echo __METHOD__.PHP_EOL;
    }

    public function getPri(Father $father){
        $father->pri();
    }
}

class Son extends Father {
    public function pub(){
        echo __METHOD__.PHP_EOL;
    }
}

$father = new Father();
$son = new Son();

$father->pub();
$son->pub();
$son->pro();

$son->getPri($father);



trait t1{
    public function hello1(){
        echo __TRAIT__.PHP_EOL;
    }

    public static function hello(){
        echo __CLASS__.PHP_EOL;
    }
}

trait t2{
    public function hello2(){
        echo __METHOD__.PHP_EOL;
        echo __TRAIT__.PHP_EOL;
    }
}

trait t3 {
    function t3(){
    }
    function hello2(){
        echo __METHOD__.PHP_EOL;
    }
}
class T{
    use t1,t2;
    use t3{
        t3::hello2 insteadof t2;
    }
}

$t = new T();
$t->hello1();
$t->hello2();
t1::hello();
echo str_repeat("*",50);
